<?php
	session_start();
	ob_start();
	function __autoload($TenLop)
	{
		include_once "classes/" . $TenLop . ".php";
	}
	include_once "thuvien.php";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>Trường THPT Chuyên Thoại Ngọc Hầu</title>
		<meta name="shortcut icon" content="DaiLy.ico">
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<link rel="shortcut icon" href="DaiLy.ico">
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<script type="text/javascript" src="scripts/ckeditor/ckeditor.js"></script>
		<script type="text/javascript" src="scripts/ckfinder/ckfinder.js"></script>
		<script type="text/javascript" src="scripts/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="scripts/jquery.validate.min.js"></script>
	</head>
	<body>
		<div id="PhanDau">
			<div id="datetime">
				<p><script language="javascript" src="scripts/today.js"></script></p>
			</div>
		</div>
		
		<div id="TrangWeb">
			<div id="MenuNgang">
				<div id="DanhMuc">
					<a href="trangchu">TRANG CHỦ</a>
				</div>
				<div id="TimKiem">
					<table width = "650">
						<tr>
							<td id = "ThongTinDangNhap" align = "left">
								<?php
									if(!isset($_SESSION['MaNguoiDung']))
										echo "Bạn chưa đăng nhập, <a href='dangnhap'>đăng nhập</a>!";
									else
										echo "Xin chào " . $_SESSION['TenNguoiDung'] . ", <a href='dangxuat'>đăng xuất</a>!";
								?>
							</td>
							<td align = "center">
								<form action="timkiem" method="POST">
									<input type="text" name="keyword" onkeydown="this.value" onblur="if (this.value=='') this.value='Tìm kiếm...';" onfocus="if (this.value=='Tìm kiếm...') this.value='';" value="Tìm kiếm..." />
									<input type = "submit" value = "Tìm"/>
								</form>
							</td>
						</tr>
					</table>
				</div>
			</div>
			<div id="PhanGiua">
				<div id="BenTrai">
					<h3>Quản lý</h3>
					<ul>
						<?php
							if(!isset($_SESSION['MaNguoiDung']))
							{
								echo '<li><a href="dangnhap">Đăng nhập</a></li>';
							}
							else
							{
								if($_SESSION['Khoa'] == 0)
								{
									echo '<li><a href="khoi">Danh sách khối lớp</a></li>';
									echo '<li><a href="lop">Danh sách lớp</a></li>';
											$lop = new lopbs();
											$ds = $lop->GetList_Khoi();
											for($i = 0; $i < count($ds); $i++)
											{
												echo '<li><a href="khoi-lop-'.$ds[$i]['MaLop'].'">'.$ds[$i]['TenKhoi'].'</a></li>';
											}
									echo '<li><a href="monhoc">Danh sách môn học</a></li>';
									echo '<li><a href="namhoc">Danh sách năm học</a></li>';
									echo '<li><a href="giaovien">Danh sách giáo viên</a></li>';
									echo '<li><a href="hocsinh">Danh sách học sinh</a></li>';
									echo '<li><a href="hanhkiem">Danh sách hạnh kiểm</a></li>';
									echo '<li><a href="hocsinh-thannhan">Danh sách thân nhân</a></li>';
									echo '<li><a href="hocsinh-thannhan">Danh sách khen thưởng - kỷ luật</a></li>';
								}
								echo '<li><a href="hosocanhan">Hồ sơ cá nhân</a></li>';
								echo '<li><a href="doimatkhau">Đổi mật khẩu</a></li>';
								
								if($_SESSION['QuyenHan'] == 1)
								{
									echo '<li><a href="baiviet_them">Đăng bài viết</a></li>';
									echo '<li><a href="chude">Danh sách chủ đề</a></li>';
									echo '<li><a href="baiviet">Danh sách bài viết</a></li>';
									echo '<li><a href="baiviet_danhsach_kiemduyet">Kiểm duyệt bài viết</a></li>';
									echo '<li><a href="lienket">Liên kết</a></li>';
									echo '<li><a href="nguoidung">Danh sách người dùng</a></li>';
								}
								
								echo '<li><a href="dangxuat">Đăng xuất</a></li>';
							}
						?>
					</ul>
					
					<h3>Chuyên mục</h3>
					<div id = "mainmenu">
						<?php
							$chude = new chudebs();
							$dschude = $chude->GetList();
							
							for ($i = 0; $i < ($dschude == false ? 0 : count($dschude)); $i++)
							{
								echo "<p><a href='baiviet_chude_" . $dschude[$i]['MaChuDe'] . "_" . $dschude[$i]['TenChuDe'] . "'>" . $dschude[$i]['TenChuDe'] . "</a></p>";
							}
						?>
					</div>
								
					<h3>Liên kết</h3>
					<ul>
						<?php
							$lienket = new lienketbs();
							$dslienket = $lienket->GetList();
							
							for ($i = 0; $i < ($dslienket == false ? 0 : count($dslienket)); $i++)
							{
								echo "<li><a href = '" . $dslienket[$i]['DiaChiLienKet'] . "' target = '_balnk'>" . $dslienket[$i]['TenLienKet'] . "</a></li>";
							}
						?>
					</ul>
                    
                    <h3>Thống kê</h3>
					<ul>
						<?php
							include_once "thongketruycap.php";
						?>
					</ul>
                               
					<h3>Đồng hồ</h3>
					<ul>
						<embed src="data/dongho.swf" quality="high" bgcolor="#ffffff" width="150" height="172" name="dongho" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br />
						<embed src="data/green.swf" quality="high" bgcolor="#ffffff" width="150" height="62" name="dongho" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
					</ul>
				</div>
				<div id="BenPhai">
					<?php
						$do = isset($_GET['do']) ? $_GET['do'] : "home";
						
						include $do . ".php";
					?>
				</div>
			</div>
		</div>
		<div id="PhanCuoi">
			<p class="BanQuyen">Copyright &copy; 2014 by Võ Thị Thanh Hằng. Email: <a href = "mailto:vtthang_12th@agu.edu.vn">vtthang_12th@agu.edu.vn</a></p>
		</div>
		
				
		<script>     
			function FloatTopDiv()     
			{     
				startLX = ((document.body.clientWidth -MainContentW)/2)-LeftBannerW-LeftAdjust , startLY = TopAdjust+80;     
				startRX = ((document.body.clientWidth -MainContentW)/2)+MainContentW+RightAdjust , startRY = TopAdjust+80;     
				var d = document;     
				function ml(id)     
				{     
					var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];    
					el.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';};     
					el.x = startRX;     
					el.y = startRY;     
					return el;     
				}     
				function m2(id)     
				{     
					var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];     
					e2.sP=function(x,y){this.style.left=x + 'px';this.style.top=y + 'px';};     
					e2.x = startLX;     
					e2.y = startLY;     
					return e2;     
				}     
				window.stayTopLeft=function()     
				{     
					if (document.documentElement && document.documentElement.scrollTop)     
						var pY =  document.documentElement.scrollTop;     
					else if (document.body)     
						var pY =  document.body.scrollTop;     
					 if (document.body.scrollTop > 30){startLY = 3;startRY = 3;} else  {startLY = TopAdjust;startRY = TopAdjust;};     
					ftlObj.y += (pY+startRY-ftlObj.y)/16;     
					ftlObj.sP(ftlObj.x, ftlObj.y);     
					ftlObj2.y += (pY+startLY-ftlObj2.y)/16;     
					ftlObj2.sP(ftlObj2.x, ftlObj2.y);     
					setTimeout("stayTopLeft()", 1);     
				}     
				ftlObj = ml("divAdRight");     
				//stayTopLeft();     
				ftlObj2 = m2("divAdLeft");     
				stayTopLeft();     
			}     
			function ShowAdDiv()     
			{     
				var objAdDivRight = document.getElementById("divAdRight");     
				var objAdDivLeft = document.getElementById("divAdLeft");       
				if (document.body.clientWidth < 1000)     
				{     
					objAdDivRight.style.display = "none";     
					objAdDivLeft.style.display = "none";     
				}     
				else     
				{     
					objAdDivRight.style.display = "block";     
					objAdDivLeft.style.display = "block";     
					FloatTopDiv();     
				}     
			} 
		</script>     
		<script>     
			document.write("<script type='text/javascript' language='javascript'>MainContentW = 1000;LeftBannerW = 125;RightBannerW = 125;LeftAdjust = 5;RightAdjust = 5;TopAdjust = 180;ShowAdDiv();window.onresize=ShowAdDiv;;<\/script>");     
		</script>
	</body>
</html>